<!doctype html>
<html>
<head>
<!--企业舆情分析系统 - 数据大屏 -->
<meta charset="utf-8">
<meta name="description" content="企业舆情分析系统数据大屏">
<meta name="keywords" content="企业舆情,威胁分析,数据可视化">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<title>"千里眼"企业舆情分析系统 - 智能监控平台</title>
<!--大屏-->
<link type="text/css" href="css/public.css" rel="stylesheet">
<link type="text/css" href="css/icon.css" rel="stylesheet">
<link type="text/css" href="css/index.css" rel="stylesheet">
<script type="text/javascript">
        document.documentElement.style.fontSize = document.documentElement.clientWidth /768*100 + 'px';
</script>
<script src="js/echarts.min.js"></script>
<script src="js/jquery-1.11.0.min.js"></script>
</head>

<body>
<div class="bg">
	<div class="title">企业舆情分析系统 - 数据大屏</div>
    <div class="leftMain">
    	<div class="leftMain_top">
        	<div class="leftMain_topIn">
            	<ul>
                	<li>
                        <div class="liIn">
                            <h3>分析企业总数</h3>
                            <p class="shu"><span class="shu1" id="total-enterprises">0</span><i>家</i></p>
                            <div class="zi"><span class="span1">已完成分析</span><span id="completed-rate">100%</span></div>
                            <span class="border_bg_leftTop"></span>
                            <span class="border_bg_rightTop"></span>
                            <span class="border_bg_leftBottom"></span>
                            <span class="border_bg_rightBottom"></span>
                        </div>
                    </li>
                	<li>
                        <div class="liIn">
                            <h3>分析会话总数</h3>
                            <p class="shu"><span class="shu2" id="total-sessions">0</span><i>次</i></p>
                            <div class="zi"><span class="span1">成功响应</span><span id="success-rate">0%</span></div>
                            <span class="border_bg_leftTop"></span>
                            <span class="border_bg_rightTop"></span>
                            <span class="border_bg_leftBottom"></span>
                            <span class="border_bg_rightBottom"></span>
                        </div>
                    </li>
                	<li>
                        <div class="liIn">
                            <h3>威胁分析总数</h3>
                            <p class="shu"><span class="shu3" id="threat-sessions">0</span><i>次</i></p>
                            <div class="zi"><span class="span1">检测威胁</span><span id="total-threats">0个</span></div>
                            <span class="border_bg_leftTop"></span>
                            <span class="border_bg_rightTop"></span>
                            <span class="border_bg_leftBottom"></span>
                            <span class="border_bg_rightBottom"></span>
                        </div>
                    </li>
                	<li>
                        <div class="liIn">
                            <h3>系统健康度</h3>
                            <p class="shu"><span class="shu4" id="system-health">100</span><i>%</i></p>
                            <div class="zi"><span class="span1">AI服务</span><span id="ai-status">正常</span></div>
                            <span class="border_bg_leftTop"></span>
                            <span class="border_bg_rightTop"></span>
                            <span class="border_bg_leftBottom"></span>
                            <span class="border_bg_rightBottom"></span>
                        </div>
                    </li>
                </ul>
            </div>
        </div>
        <div class="leftMain_middle">
        	<div class="leftMain_middle_left">
            	<div class="leftMain_middle_leftIn">
                	<h3>近7天分析趋势</h3>
                    <!-- 为ECharts准备一个具备大小（宽高）的Dom -->
                    <div class="biaoge" style="width:100%; height:25vh" id="chartmain"></div>
                    <span class="border_bg_leftTop"></span>
                    <span class="border_bg_rightTop"></span>
                    <span class="border_bg_leftBottom"></span>
                    <span class="border_bg_rightBottom"></span>
                </div>
            </div>
        	<div class="leftMain_middle_right">
            	<div class="leftMain_middle_rightIn">
                	<h3>企业风险排名</h3>
                    <div class="biaoge biaoge_pai" style="width:100%; height:25vh">
                    	<div class="biaoge_paiIn">
                        	<ul id="enterprise-rankings">
                            	<!-- 企业排名将通过JavaScript动态生成 -->
                           </ul>
                        </div>
                    </div>
                    <span class="border_bg_leftTop"></span>
                    <span class="border_bg_rightTop"></span>
                    <span class="border_bg_leftBottom"></span>
                    <span class="border_bg_rightBottom"></span>
                </div>
            </div>
        </div>
        <div class="leftMain_middle">
        	<div class="leftMain_middle_left">
            	<div class="leftMain_middle_leftIn">
                	<h3>威胁等级分布</h3>
                    <div class="biaoge" style="width:100%; height:25vh" id="threat-level-chart"></div>
                    <span class="border_bg_leftTop"></span>
                    <span class="border_bg_rightTop"></span>
                    <span class="border_bg_leftBottom"></span>
                    <span class="border_bg_rightBottom"></span>
                </div>
            </div>
        	<div class="leftMain_middle_right">
            	<div class="leftMain_middle_rightIn">
                	<h3>实时系统状态</h3>
                    <div class="biaoge biaoge_bi" style="width:100%; height:25vh">
                    	<ul id="system-status-list">
                            <!-- 系统状态将通过JavaScript动态生成 -->
                        </ul>
                    </div>
                    <span class="border_bg_leftTop"></span>
                    <span class="border_bg_rightTop"></span>
                    <span class="border_bg_leftBottom"></span>
                    <span class="border_bg_rightBottom"></span>
                </div>
            </div>
        </div>
    </div>
    
    <div class="rightMain">
    	<div class="rightMain_top">
        	<div class="rightMain_topIn">
            	<h3>最新分析会话</h3>
                <div class="rightMain_topIn_content" id="recent-sessions">
                    <!-- 最新会话将通过JavaScript动态生成 -->
                </div>
                <span class="border_bg_leftTop"></span>
                <span class="border_bg_rightTop"></span>
                <span class="border_bg_leftBottom"></span>
                <span class="border_bg_rightBottom"></span>
            </div>
        </div>
        <div class="rightMain_middle">
        	<div class="rightMain_middleIn">
            	<h3>AI服务提供商状态</h3>
                <div class="rightMain_middle_content" style="height:30vh" id="provider-status-chart"></div>
                <span class="border_bg_leftTop"></span>
                <span class="border_bg_rightTop"></span>
                <span class="border_bg_leftBottom"></span>
                <span class="border_bg_rightBottom"></span>
            </div>
        </div>
        <div class="rightMain_bottom">
        	<div class="rightMain_bottomIn">
            	<h3>威胁分析详情</h3>
                <div class="rightMain_bottom_content" id="threat-details">
                    <!-- 威胁详情将通过JavaScript动态生成 -->
                </div>
                <span class="border_bg_leftTop"></span>
                <span class="border_bg_rightTop"></span>
                <span class="border_bg_leftBottom"></span>
                <span class="border_bg_rightBottom"></span>
            </div>
        </div>
    </div>
    
    <div class="middleMain">
    	<div class="middleMain_map">
        	<div class="middleMain_mapIn">
            	<h3>分析活动热力图</h3>
                <div class="middleMain_map_chart" style="width:100%; height:35vh" id="activity-heatmap"></div>
                <span class="border_bg_leftTop"></span>
                <span class="border_bg_rightTop"></span>
                <span class="border_bg_leftBottom"></span>
                <span class="border_bg_rightBottom"></span>
            </div>
        </div>
    </div>
</div>

<script type="text/javascript">
// 企业舆情分析系统 - 数据大屏 JavaScript
const API_BASE = '/api';
let dashboardData = {
    stats: {},
    dailyAnalysis: [],
    threatDistribution: [],
    enterpriseRankings: [],
    recentSessions: [],
    providerStatus: {}
};

// 数字滚动动画
function animateNumber(elementId, endValue, duration = 2000) {
    const element = document.getElementById(elementId);
    if (!element) return;
    
    const startValue = 0;
    const increment = endValue / (duration / 50);
    let currentValue = startValue;
    
    const timer = setInterval(() => {
        currentValue += increment;
        if (currentValue >= endValue) {
            currentValue = endValue;
            clearInterval(timer);
        }
        element.textContent = Math.floor(currentValue);
    }, 50);
}

// 加载数据 - 使用新的专用API
async function loadDashboardData() {
    console.log('开始加载大屏数据...');
    
    try {
        // 1. 加载概览数据
        console.log('正在加载概览数据...');
        const overviewResponse = await fetch(`${API_BASE}/bigscreen/overview`);
        console.log('概览数据响应状态:', overviewResponse.status);
        
        if (overviewResponse.ok) {
            const overviewData = await overviewResponse.json();
            console.log('概览数据:', overviewData);
            
            if (overviewData.success) {
                updateBasicStats(overviewData.data);
                updateTrendChart(overviewData.data.daily_trend || []);
            }
        }
        
        // 2. 加载威胁分布数据
        console.log('正在加载威胁分布数据...');
        const threatResponse = await fetch(`${API_BASE}/bigscreen/threat-distribution`);
        console.log('威胁分布响应状态:', threatResponse.status);
        
        if (threatResponse.ok) {
            const threatData = await threatResponse.json();
            console.log('威胁分布数据:', threatData);
            
            if (threatData.success) {
                updateEnterpriseRankings(threatData.data.enterprise_rankings || []);
                updateThreatLevelChart(threatData.data.level_distribution || {});
            }
        }
        
        // 3. 加载最近活动数据
        console.log('正在加载最近活动数据...');
        const activityResponse = await fetch(`${API_BASE}/bigscreen/recent-activity`);
        console.log('最近活动响应状态:', activityResponse.status);
        
        if (activityResponse.ok) {
            const activityData = await activityResponse.json();
            console.log('最近活动数据:', activityData);
            
            if (activityData.success) {
                updateRecentSessions(activityData.data.recent_sessions || []);
                updateThreatDetails(activityData.data.recent_threat_sessions || []);
                updateActivityHeatmap(activityData.data.hourly_activity || []);
            }
        }
        
        // 4. 加载系统监控数据
        console.log('正在加载系统监控数据...');
        const monitorResponse = await fetch(`${API_BASE}/bigscreen/system-monitor`);
        console.log('系统监控响应状态:', monitorResponse.status);
        
        if (monitorResponse.ok) {
            const monitorData = await monitorResponse.json();
            console.log('系统监控数据:', monitorData);
            
            if (monitorData.success) {
                updateSystemStatus(monitorData.data);
            }
        }
        
        // 5. 加载AI服务提供商状态
        console.log('正在加载AI服务提供商状态...');
        const providerResponse = await fetch(`${API_BASE}/bigscreen/provider-status`);
        console.log('AI服务提供商响应状态:', providerResponse.status);
        
        if (providerResponse.ok) {
            const providerData = await providerResponse.json();
            console.log('AI服务提供商数据:', providerData);
            
            if (providerData.success) {
                updateProviderStatusChart(providerData.data);
            }
        }
        
        console.log('大屏数据加载完成');
        
    } catch (error) {
        console.error('加载数据失败:', error);
        showDefaultData();
    }
}

// 显示默认数据
function showDefaultData() {
    console.log('显示默认数据');
    const defaultData = {
        basic_stats: {
            total_enterprises: 0,
            total_sessions: 0,
            completed_sessions: 0,
            avg_questions: 0
        },
        threat_stats: {
            threat_sessions: 0,
            total_threats: 0,
            avg_threat_score: 0
        },
        system_health: {
            success_rate: 100,
            total_responses: 0,
            successful_responses: 0
        }
    };
    updateBasicStats(defaultData);
    updateTrendChart([]);
    updateEnterpriseRankings([]);
    updateRecentSessions([]);
}

// 更新基础统计
function updateBasicStats(data) {
    console.log('更新基础统计:', data);
    
    const basic = data.basic_stats || {};
    const threat = data.threat_stats || {};
    const health = data.system_health || {};
    
    // 动画更新数字
    animateNumber('total-enterprises', basic.total_enterprises || 0);
    animateNumber('total-sessions', basic.total_sessions || 0);
    animateNumber('threat-sessions', threat.threat_sessions || 0);
    animateNumber('system-health', health.success_rate || 100);
    
    // 更新文本信息
    const successRateElement = document.getElementById('success-rate');
    const totalThreatsElement = document.getElementById('total-threats');
    const aiStatusElement = document.getElementById('ai-status');
    
    if (successRateElement) successRateElement.textContent = (health.success_rate || 100) + '%';
    if (totalThreatsElement) totalThreatsElement.textContent = (threat.total_threats || 0) + '个';
    if (aiStatusElement) aiStatusElement.textContent = (health.success_rate || 100) > 80 ? '正常' : '异常';
}

// 更新趋势图表
function updateTrendChart(dailyData) {
    const chartDom = document.getElementById('chartmain');
    if (!chartDom) {
        console.warn('趋势图表容器未找到');
        return;
    }
    
    const myChart = echarts.init(chartDom);
    
    // 处理数据，确保有7天的数据
    const today = new Date();
    const dates = [];
    const counts = [];
    
    for (let i = 6; i >= 0; i--) {
        const date = new Date(today);
        date.setDate(date.getDate() - i);
        const dateStr = date.toISOString().split('T')[0];
        const dayData = dailyData.find(d => d.date === dateStr);
        
        dates.push((date.getMonth() + 1) + '/' + date.getDate());
        counts.push(dayData ? dayData.count : 0);
    }
    
    console.log('趋势图表数据:', { dates, counts });
    
    const option = {
        title: { text: '' },
        grid: { x: 40, y: 40, x2: 20, y2: 20 },
        xAxis: {
            data: dates,
            axisLabel: {
                interval: 0,
                textStyle: { color: '#fff', fontSize: 12 }
            },
            axisTick: { show: false },
            axisLine: {
                show: true,
                symbol: ['none', 'arrow'],
                symbolOffset: 12,
                lineStyle: { color: '#fff' }
            }
        },
        yAxis: {
            type: 'value',
            name: '单位：次',
            axisLine: {
                show: true,
                symbol: ['none', 'arrow'],
                symbolOffset: 12,
                lineStyle: { color: '#fff' }
            },
            axisTick: { show: false },
            axisLabel: {
                textStyle: { color: '#fff', fontSize: 12 }
            }
        },
        series: [{
            type: 'bar',
            itemStyle: {
                color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
                    { offset: 0, color: '#0efdff' },
                    { offset: 0.5, color: '#188df0' },
                    { offset: 1, color: '#188df0' }
                ])
            },
            data: counts
        }]
    };
    
    myChart.setOption(option);
}

// 更新企业风险排名
function updateEnterpriseRankings(rankings) {
    const container = document.getElementById('enterprise-rankings');
    const limitedRankings = rankings.slice(0, 6);
    
    if (limitedRankings.length === 0) {
        container.innerHTML = '<li><div class="liIn"><div class="zi">暂无威胁数据</div></div></li>';
        return;
    }
    
    const html = limitedRankings.map((enterprise, index) => {
        const percentage = Math.min(enterprise.avg_score * 10, 100);
        const orderNames = ['第一名', '第二名', '第三名', '第四名', '第五名', '第六名'];
        
        return `
            <li>
                <div class="liIn liIn${index + 1}">
                    <div class="liIn_left">
                        <span class="bot"></span>
                        <span class="zi">${orderNames[index]}</span>
                    </div>
                    <div class="liIn_line">
                        <div class="line_lineIn" style="width:${percentage}%;"></div>
                    </div>
                    <p class="num">${enterprise.avg_score}</p>
                </div>
            </li>
        `;
    }).join('');
    
    container.innerHTML = html;
}

// 更新威胁等级分布图
function updateThreatLevelChart(distribution) {
    const chartDom = document.getElementById('threat-level-chart');
    const myChart = echarts.init(chartDom);
    
    const data = [
        { name: '严重', value: distribution.critical || 0, color: '#dc2626' },
                                { name: '高危', value: distribution.high || 0, color: '#ca5010' },
                        { name: '中危', value: distribution.medium || 0, color: '#da7b11' },
                        { name: '低危', value: distribution.low || 0, color: '#16a085' }
    ];
    
    const option = {
        title: { text: '' },
        tooltip: {
            trigger: 'item',
            formatter: '{a} <br/>{b}: {c} ({d}%)'
        },
        legend: {
            orient: 'vertical',
            left: 'left',
            textStyle: { color: '#fff', fontSize: 12 }
        },
        series: [{
            name: '威胁等级',
            type: 'pie',
            radius: ['40%', '70%'],
            center: ['60%', '50%'],
            data: data,
            itemStyle: {
                color: function(params) {
                    return data[params.dataIndex].color;
                }
            },
            label: {
                textStyle: { color: '#fff' }
            }
        }]
    };
    
    myChart.setOption(option);
}

// 更新最近会话
function updateRecentSessions(sessions) {
    const container = document.getElementById('recent-sessions');
    const limitedSessions = sessions.slice(0, 10);
    
    if (limitedSessions.length === 0) {
        container.innerHTML = '<div style="color:#666;text-align:center;padding:20px;">暂无最近分析会话</div>';
        return;
    }
    
    const html = limitedSessions.map(session => `
        <div style="padding:8px 0;border-bottom:1px solid #333;color:#fff;font-size:12px;">
            <div style="margin-bottom:4px;">
                <strong>${session.enterprise_name}</strong>
                <span style="float:right;color:#0efdff;">${session.total_questions || 0}个问题</span>
            </div>
            <div style="color:#999;">
                ${new Date(session.created_at).toLocaleString()}
                <span style="float:right;color:${session.status === 'completed' ? '#16a085' : '#ca5010'};">
                    ${session.status === 'completed' ? '已完成' : '进行中'}
                </span>
            </div>
        </div>
    `).join('');
    
    container.innerHTML = html;
}

// 更新系统状态
function updateSystemStatus(data) {
    const container = document.getElementById('system-status-list');
    const systemStatus = data.system_status || {};
    const performance = data.performance_metrics || {};
    
    const statusItems = [
        { name: '数据库', status: systemStatus.database || false },
        { name: '分析系统', status: systemStatus.analysis_system || false },
        { name: '威胁系统', status: systemStatus.threat_system || false },
        { name: 'AI服务', status: (systemStatus.ai_providers || []).length > 0 }
    ];
    
    const html = statusItems.map(item => `
        <li style="padding:10px 0;border-bottom:1px solid #333;">
            <div style="display:flex;justify-content:space-between;align-items:center;color:#fff;">
                <span>${item.name}</span>
                <span style="color:${item.status ? '#16a085' : '#dc2626'};">
                    ${item.status ? '● 正常' : '● 异常'}
                </span>
            </div>
        </li>
    `).join('');
    
    // 添加性能指标
    const perfHtml = `
        <li style="padding:10px 0;border-bottom:1px solid #333;">
            <div style="color:#fff;font-size:11px;">
                <div>平均响应时间: ${(performance.avg_response_time || 0).toFixed(2)}s</div>
                <div>错误率: ${(performance.error_rate || 0).toFixed(1)}%</div>
                <div>健康评分: ${(data.health_score || 100).toFixed(0)}分</div>
            </div>
        </li>
    `;
    
    container.innerHTML = html + perfHtml;
}

// 更新AI服务提供商状态图表
function updateProviderStatusChart(data) {
    const chartDom = document.getElementById('provider-status-chart');
    if (!chartDom) {
        console.warn('AI服务提供商图表容器未找到');
        return;
    }
    
    const myChart = echarts.init(chartDom);
    const providers = data.providers || {};
    const summary = data.summary || {};
    
    // 如果没有配置的提供商
    if (Object.keys(providers).length === 0) {
        const option = {
            title: { 
                text: summary.message || '暂无配置',
                textStyle: { color: '#999', fontSize: 12 },
                left: 'center',
                top: 'center'
            },
            series: []
        };
        myChart.setOption(option);
        return;
    }
    
    // 构建图表数据
    const chartData = Object.values(providers).map(provider => ({
        name: provider.name.toUpperCase(),
        value: 1,
        itemStyle: {
            color: provider.color || '#666'
        }
    }));
    
    const option = {
        title: { 
            text: summary.message || `活跃: ${summary.active_providers}/${summary.total_providers}`,
            textStyle: { color: '#fff', fontSize: 12 },
            left: 'center',
            top: 15
        },
        tooltip: {
            trigger: 'item',
            formatter: function(params) {
                const provider = providers[params.name.toLowerCase()];
                let tooltip = `${params.name}<br/>状态: ${provider.status_text}`;
                if (provider.has_api_key) {
                    tooltip += `<br/>密钥长度: ${provider.api_key_length}字符`;
                    tooltip += `<br/>启用: ${provider.enabled ? '是' : '否'}`;
                }
                return tooltip;
            }
        },
        series: [{
            type: 'pie',
            radius: ['25%', '55%'],
            center: ['50%', '60%'],
            data: chartData,
            label: {
                show: true,
                position: 'outside',
                formatter: function(params) {
                    const provider = providers[params.name.toLowerCase()];
                    return `${params.name}\n${provider.status_text}`;
                },
                textStyle: { color: '#fff', fontSize: 9 }
            },
            labelLine: {
                show: true,
                lineStyle: { color: '#fff' }
            },
            emphasis: {
                itemStyle: {
                    shadowBlur: 10,
                    shadowOffsetX: 0,
                    shadowColor: 'rgba(0, 0, 0, 0.5)'
                }
            }
        }]
    };
    
    myChart.setOption(option);
}

// 更新威胁分析详情
function updateThreatDetails(threatSessions) {
    const container = document.getElementById('threat-details');
    const sessions = threatSessions.slice(0, 8);
    
    if (sessions.length === 0) {
        container.innerHTML = '<div style="color:#666;text-align:center;padding:20px;">暂无威胁分析</div>';
        return;
    }
    
    const html = sessions.map(session => `
        <div style="padding:8px 0;border-bottom:1px solid #333;color:#fff;font-size:11px;">
            <div style="margin-bottom:4px;">
                <strong>${session.enterprise_name}</strong>
                <span style="float:right;color:${getLevelColor(session.highest_threat_level)};">
                    ${getThreatLevelText(session.highest_threat_level)}
                </span>
            </div>
            <div style="color:#999;display:flex;justify-content:space-between;">
                <span>威胁: ${session.threats_detected || 0}个</span>
                <span>${new Date(session.analysis_started_at).toLocaleDateString()}</span>
            </div>
        </div>
    `).join('');
    
    container.innerHTML = html;
}

// 更新分析活动热力图
function updateActivityHeatmap(hourlyData) {
    const chartDom = document.getElementById('activity-heatmap');
    if (!chartDom) {
        console.warn('活动热力图容器未找到');
        return;
    }
    
    const myChart = echarts.init(chartDom);
    
    // 构建24小时热力图数据
    const heatmapData = [];
    const maxValue = Math.max(...hourlyData.map(d => d.count));
    
    hourlyData.forEach((item, index) => {
        heatmapData.push([index, 0, item.count]);
    });
    
    const option = {
        title: {
            text: '24小时活动分布',
            textStyle: { color: '#fff', fontSize: 14 },
            left: 'center'
        },
        tooltip: {
            position: 'top',
            formatter: function(params) {
                return `${params.data[0]}:00 - 分析次数: ${params.data[2]}`;
            }
        },
        grid: {
            height: '80%',
            top: '15%'
        },
        xAxis: {
            type: 'category',
            data: Array.from({length: 24}, (_, i) => i + 'h'),
            splitArea: { show: true },
            axisLabel: { color: '#fff', fontSize: 10 }
        },
        yAxis: {
            type: 'category',
            data: ['活动'],
            splitArea: { show: true },
            axisLabel: { color: '#fff', fontSize: 10 }
        },
        visualMap: {
            min: 0,
            max: maxValue || 10,
            calculable: true,
            orient: 'horizontal',
            left: 'center',
            bottom: '5%',
            textStyle: { color: '#fff' },
            inRange: {
                color: ['#313695', '#4575b4', '#74add1', '#abd9e9', '#e0f3f8', '#ffffcc', '#fee090', '#fdae61', '#f46d43', '#d73027', '#a50026']
            }
        },
        series: [{
            name: '活动热力',
            type: 'heatmap',
            data: heatmapData,
            label: {
                show: true,
                color: '#fff',
                fontSize: 10
            },
            emphasis: {
                itemStyle: {
                    shadowBlur: 10,
                    shadowColor: 'rgba(0, 0, 0, 0.5)'
                }
            }
        }]
    };
    
    myChart.setOption(option);
}

// 辅助函数
function getLevelColor(level) {
    const colors = {
        'critical': '#dc2626',
        'high': '#ca5010',
        'medium': '#da7b11',
        'low': '#16a085'
    };
    return colors[level] || '#666';
}

function getThreatLevelText(level) {
    const texts = {
        'critical': '严重',
        'high': '高危',
        'medium': '中危',
        'low': '低危'
    };
    return texts[level] || '未知';
}

// 页面加载时初始化
window.onload = function() {
    console.log('企业舆情分析系统数据大屏加载完成');
    loadDashboardData();
    
    // 定时刷新数据（每30秒）
    setInterval(loadDashboardData, 30000);
};

// 窗口大小变化时重新调整图表
window.onresize = function() {
    const charts = ['chartmain', 'threat-level-chart', 'provider-status-chart', 'activity-heatmap'];
    charts.forEach(chartId => {
        const chartDom = document.getElementById(chartId);
        if (chartDom && echarts.getInstanceByDom(chartDom)) {
            echarts.getInstanceByDom(chartDom).resize();
        }
    });
};
</script>

</body>
</html>
